package main

import (
	"fmt"
	"sync"
	"time"
)

func worker(id int) {
	fmt.Println("worker start,", id)
	time.Sleep(time.Second)
	fmt.Println("worker done,", id)
}
func main() {
	var wg sync.WaitGroup
	for i := 0; i < 5; i++ {
		wg.Add(1)
		go func(j int) {
			defer wg.Done()
			worker(j)
		}(i)
	}
	wg.Wait()
}
